package com.yt.base.service.impl;

import java.util.List;

import com.yt.base.dao.AclGroupDao;
import com.yt.base.model.AclGroup;
import com.yt.base.service.AclGroupService;
import com.yt.core.dao.filter.DynamicSQLFilterImpl;
import com.yt.core.dao.filter.QueryFilter;
import com.yt.core.service.GenericServiceImpl;

/**
 * Created by liujunshi on 15-1-28.
 */
public class AclGroupServiceImpl extends GenericServiceImpl<AclGroup, Long> implements AclGroupService {
	private AclGroupDao dao;

	public AclGroupServiceImpl(AclGroupDao dao) {
		super(dao);
		this.dao = dao;
	}
	
	@Override
	public AclGroup findByName(String name) {
		
		QueryFilter filter = new DynamicSQLFilterImpl();
		filter.addFilter("Q_name_S_EQ", name);
		
		List<AclGroup> list = find(filter);
		
		return (list == null || list.size() == 0) ? null : list.get(0);
	}
	
	@Override
	public List<AclGroup> findAll() {
		return dao.getAll();
	}
}
